#include <stdio.h>
#include <string.h>

#define SIZE 100

void swap(char s[], int l, int r)
{
        s[l] ^= s[r];
        s[r] ^= s[l];
        s[l] ^= s[r];
}

void print_all(char s[], int size)
{
        for (int i = 0; i < size; i++)
                printf("%c", s[i]);
        printf("\n");
}

void reverse(char s[], int size, int left, int right, int N)
{
        if (size <= 1)
                return;
        swap(s, left, right);
        print_all(s, N);
        reverse(s, size-2, left + 1, right - 1, N);
}

int main()
{
        char s[SIZE + 1];
        int n;
        scanf("%d", &n);
        getchar();
        gets(s);
        reverse(s, n, 0, n - 1, n);
        printf("\n");
        print_all(s, n);
        return 0;
}